package com.greenline.push.service.core.fetch;

import javax.annotation.Resource;

import org.apache.log4j.Logger;

import com.greenline.push.core.enums.Tasks;
import com.greenline.push.service.core.ProcessQueueList;
import com.greenline.push.service.core.exception.TaskException;
import com.greenline.push.service.core.task.FetchUploadTypeToRetrySchedule;
import com.greenline.push.service.core.utils.Constants;

public class AsyncFetchUploadPushFetcher extends DeaultAsyncFetcher {
    @Resource
    private FetchUploadTypeToRetrySchedule fetchUploadTypeToRetrySchedule;
    private final Logger logger = Constants.LOG_SCHEDULE;

    @Override
    protected Tasks getTask() {
        return Tasks.FETCH_UPLOAD_TO_RETRY;
    }

    @Override
    protected void startTask(ProcessQueueList processQueueList, Tasks task) {
        try {
            fetchUploadTypeToRetrySchedule.startTask();
        } catch (TaskException e) {
            e.printStackTrace();
            logger.error(String.format("task:%s.启动异常.信息:%s", task, e.getMessage()));
        }
    }

}
